Skip to content

Conversation

@alexcos20
Copy link
Member

Fixes #816

Changes proposed in this PR:

  • sign ddo only if config.validateUnsignedDDO is true or if publisher is checked (nonce, signature, etc(

@alexcos20 alexcos20 marked this pull request as ready for review January 9, 2026 11:51
@alexcos20 alexcos20 self-assigned this Jan 9, 2026
@alexcos20
Copy link
Member Author

/run-security-scan

1 similar comment
@alexcos20
Copy link
Member Author

/run-security-scan

Copy link
Member Author

@alexcos20 alexcos20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI automated code review (Gemini 3).

Overall risk: medium

Summary:
This pull request refactors the DDO validation and signature generation logic, making signature generation conditional. It also introduces explicit username and password configuration for Elasticsearch databases in CI/test environments and enforces these credentials in the database utility function. Minor style changes to node-version strings in CI workflow are also included, and a new unit test for the DDO signature logic is added.

Comments:
• [WARNING][security] Hardcoding DB_USERNAME and DB_PASSWORD directly in the CI workflow is generally not recommended, even for test environments. Consider using GitHub Secrets for these values, or at least documenting that these are for ephemeral/test instances only. While 'changeme' implies it's a default, it's still visible.
• [WARNING][security] Same comment as line 89: Hardcoding DB_USERNAME and DB_PASSWORD directly in the CI workflow is generally not recommended. Consider using GitHub Secrets.
• [WARNING][security] Same comment as line 89: Hardcoding DB_USERNAME and DB_PASSWORD directly in the CI workflow is generally not recommended. Consider using GitHub Secrets.
• [INFO][other] The removal of the skipValidation helper function and integrating its logic directly into handle seems like a good simplification and refactoring. This improves readability by keeping related logic within the handle method.
• [INFO][other] The introduction of the shouldSign boolean variable and its conditional assignment clarifies when a DDO signature should be generated. This directly addresses the PR's title 'validateDDO_signature_fix' by making signature generation more explicit and conditional based on configuration or presence of authentication parameters.
• [INFO][other] The conditional return for stream based on shouldSign correctly implements the new logic, ensuring a signature is only generated and returned when necessary. This is a crucial part of the fix.
• [INFO][other] Commenting out sinon related imports and variables, and the stubbing logic suggests that the previous mocking might have been unnecessary or problematic for the updated validation logic. Ensure that this change doesn't inadvertently remove critical test coverage for other parts of the validation.test.ts file that might have relied on sinon.
• [INFO][other] The addition of a new unit test should have node signature for valid user is excellent for verifying the new conditional signature generation logic introduced in ddoHandler.ts. This provides good coverage for the bug fix.
• [INFO][security] The updated hasValidDBConfiguration function correctly enforces that Elasticsearch configurations must include a username and password. This is a positive security enhancement, ensuring that authentication details are not accidentally omitted for Elasticsearch connections.

Copy link
Member Author

@alexcos20 alexcos20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI automated code review (Gemini 3).

Overall risk: low

Summary:
This pull request refactors the DDO signature validation logic and introduces mandatory authentication for Elasticsearch in various configurations and tests. The core change clarifies when the node should return a DDO validation signature, making the behavior more explicit based on configuration and request parameters. Additionally, it updates CI workflows and test environments to include DB_USERNAME and DB_PASSWORD for Elasticsearch, and enhances hasValidDBConfiguration to enforce these credentials for Elasticsearch type databases.

Comments:
• [INFO][style] The change from double quotes to single quotes for node versions and lists in ci.yml is purely cosmetic. Please ensure this is consistent with the project's YAML style guide, if one exists.
• [INFO][other] The refactoring of the DDO validation logic, specifically introducing the shouldSign flag, provides a clearer and more explicit control over when the node generates and returns its own signature for a validated DDO. This seems to correctly address situations where a signature might not be required or expected, aligning better with authenticated vs. unauthenticated validation flows. Good improvement!
• [WARNING][other] It looks like the sinon sandbox setup was commented out. Is this temporary, or is sinon no longer used for mocking in this test? If it's no longer needed, consider removing the commented-out code and related imports to keep the codebase clean.
• [INFO][security] Adding checks for username and password for Elasticsearch configurations in hasValidDBConfiguration is a good security enhancement. This ensures that Elasticsearch connections are properly authenticated, which is a positive step for deployment robustness and security.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ValidateDDOCommand - getValidationSignature only for authentificated requests

3 participants